package com.example.springboot.service;

import com.example.springboot.entity.notifications;
import com.example.springboot.mapper.notificationsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class notificationsService {

    @Autowired
    private notificationsMapper notificationsMapper;

    // 添加新的方法，根据用户 ID 获取通知列表
    public List<notifications> findnotificationsByUserId(int user_id) {
        return notificationsMapper.findByUserId(user_id);
    }

    // 标记通知为已读
    public void markAsRead(int notification_id) {
        notificationsMapper.markAsRead(notification_id);
    }

    // 获取通知的读取状态
    public String getReadStatus(int notification_id) {
        return notificationsMapper.getReadStatus(notification_id);
    }
}